<!--
 * @Author: zhangYaRan
 * @Date: 2020-06-01 10:00:55
 * @LastEditors: zhangYaRan
 * @LastEditTime: 2020-06-01 10:02:31
 * @Description:
-->

<template>
  <div class="registered-container userPayBilling appMainWarp">
    <el-table
      ref="table"
      v-loading="page.tableLoading"
      center
      class="accessmanagementTable"
      :data="treeTable"
      row-key="id"
      border
      default-expand-all
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      stripe
    >
      <el-table-column label="权限结构" align="left">
        <template slot-scope="scope">{{ scope.row.title ||'-' }}</template>
      </el-table-column>

      <el-table-column label="名称" align="center">
        <template slot-scope="scope">{{ scope.row.menu_name ||'-' }}</template>
      </el-table-column>

      <el-table-column label="排序" align="center">
        <template slot-scope="scope">{{ scope.row.sort ||'-' }}</template>
      </el-table-column>
      <el-table-column label="类型" align="center">
        <template
          slot-scope="scope"
        >{{ scope.row.level==1?'项目':scope.row.level==2?'模块':scope.row.level==3?'操作':'-' }}</template>
      </el-table-column>

      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-link
            v-if="scope.row.level!=3"
            :underline="false"
            type="success"
            @click="addRouter(scope.row)"
          >{{ scope.row.level==1?'添加模块':'添加节点' }}</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
          <el-link :underline="false" type="primary" @click="weiteRouter(scope.row)">修改</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
          <el-link
            v-if="scope.row.id!='1'"
            :underline="false"
            type="danger"
            @click="removeRouter(scope.row)"
          >删除</el-link>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog title="添加权限" :visible.sync="addModel.flag" width="700px">
      <el-form ref="addModel" :model="addModel.item" label-width="100px">
        <el-form-item label="英文名称" prop="menu_name">
          <el-input v-model="addModel.item.menu_name" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>

        <el-form-item label="中文名称" prop="title">
          <el-input v-model="addModel.item.title" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>

        <!-- <el-form-item label="PHP操作名" prop="name">
          <el-input v-model="addModel.item.name" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>-->

        <!-- <el-form-item label="是否显示菜单" prop="in_menu">
          <el-radio-group v-model="addModel.item.in_menu">
            <el-radio :label="1">显示</el-radio>
            <el-radio :label="0">不显示</el-radio>
          </el-radio-group>
        </el-form-item> -->

        <el-form-item label="状态" prop="status">
          <el-radio-group v-model="addModel.item.status">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="0">禁用</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item v-if="addModel.item.pid!=0" label="父节点:">
          <el-select v-model="addModel.item.pid" placeholder="请选择">
            <el-option v-for="item in pidList" :key="item.id" :label="item.title" :value="item.id" />
          </el-select>
        </el-form-item>

        <el-form-item label="访问地址" prop="url">
          <el-input v-model="addModel.item.url" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>
        <el-form-item label="页面目录" prop="project_address">
          <el-input v-model="addModel.item.project_address" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>
        <el-form-item label="配置信息" prop="config_info">
          <el-input v-model="addModel.item.config_info" placeholder="请输入内容" autocomplete="off" />
        </el-form-item>

        <el-form-item label="排序" prop="sort">

          <el-input-number v-model="addModel.item.sort" :min="1" label="描述文字" />
        </el-form-item>
        <el-form-item label="描述" prop="remark">
          <el-input
            v-model="addModel.item.remark"
            type="textarea"
            placeholder="请输入内容"
            show-word-limit
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="addModel.flag = false">取 消</el-button>
        <el-button type="primary" @click="checkChange">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'UserPayBilling',
  components: {},
  data() {
    return {
    }
  },
  created() {
  }

}
</script>

<style>
</style>

